﻿using System;
using System.Collections.Generic;
using System.Text;


namespace Ledict.Utility.Extension
{
    public static class FusoinChartExtensions
    {
        public static string ToJsonData(this Dictionary<string, double> src)
        {
            var sb = new StringBuilder();
            bool first=true;
            sb.Append("[");
            foreach (var item in src)
            {
                if (first)
                {
                    first=false;
                }
                else
                {
                    sb.Append(",");
                }
                sb.Append("{");
                sb.Append("\"label\"");
                sb.Append(":");
                sb.Append("\""+item.Key+"\",");
                sb.Append("\"value\"");
                sb.Append(":");
                sb.Append("\"" + item.Value + "\"");
                sb.Append("}");
            }
            sb.Append("]");
            return sb.ToString();
        }
    }
}